within ThreeD_MBS_Dynamics.Examples.OmniVehicle.PointContact;

model RollerPointContactForces
  import ThreeD_MBS_Dynamics;
  extends RollerPointContactVelocities;
  parameter Real delta = 10^(-6);
  parameter Real fric = 0;
//  parameter Real fric = 0.1;
  Real mu;
  Real[3] Forcet;
  Real Drelvn;
  Real Forcen;
  Real w;
equation
  w = (InPortB.T*i)*nA;
  if noEvent(abs((InPortB.T*i)*nA) < cos_of_max and h < R) then //??
//    relvn = 0;
    Drelvn = 0;
//    rB[2] = 0;
    Forcet = -fric*relvt*(if noEvent(relvtsqrt <= delta) then 1/delta else 1/relvtsqrt)*Forcen + mu*nA;
  else
    Forcen = 0;
    Forcet = zeros(3);
  end if;
  Drelvn = der(relvn);
  Forcen = OutPortB.F*nA;
  OutPortB.F = Forcet + Forcen*nA;
  OutPortB.M = zeros(3);
end RollerPointContactForces;
